home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / MACtive Desktop / Source / Headers / swarm.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-03-17  |  1.3 KB  |  63 lines  |  [TEXT/CWIE]

  1. #ifndef    _SWARM_
  2. #define    _SWARM_
  3.  
  4.  
  5.  
  6.  
  7.  
  8. #define TIMES    4        /* number of time positions recorded */
  9. #define BEEACC    3        /* acceleration of bees */
  10. #define WASPACC 5        /* maximum acceleration of wasp */
  11. #define BEEVEL    11        /* maximum bee velocity */
  12. #define WASPVEL 12        /* maximum wasp velocity */
  13. #define BORDER    15        /* wasp won't go closer than this to the edge */
  14.  
  15. /* Macros */
  16. #define X(t,b)    (sp->x[(t)*sp->beecount+(b)])
  17. #define Y(t,b)    (sp->y[(t)*sp->beecount+(b)])
  18. #define RAND(v)    ((rand()%(v))-((v)/2))    /* random number around 0 */
  19.  
  20.  
  21. #define    MAXSCREENS    1
  22.  
  23.  
  24. typedef struct Segment
  25. {
  26.     int    x1,x2,y1,y2;
  27. } Segment;
  28.  
  29.  
  30. typedef struct
  31. {
  32.     short        width;
  33.     short        height;
  34.     Rect        bounds;
  35.     RgnHandle    cliprgn;
  36.     WindowPtr    window;
  37.     RGBColor    backcolor;
  38.     RGBColor    inversebackcolor;
  39.     RGBColor    beecolor;
  40.     short        beecolorindex;
  41.     short        beecount;                /* number of bees */
  42.     Segment       *segs;                    /* bee lines */
  43.     Segment       *old_segs;                /* old bee lines */
  44.     short        *x;
  45.     short        *y;                        /* bee positions x[time][bee#] */
  46.     short        *xv;
  47.     short        *yv;                    /* bee velocities xv[bee#] */
  48.     short       wx[3];
  49.     short       wy[3];
  50.     short       wxv;
  51.     short       wyv;
  52. } swarmstruct;
  53.  
  54.  
  55.  
  56.  
  57.  
  58. void *NewSwarm(int batchcount,Rect *bounds,WindowPtr window);
  59. void SwarmIdle(void *dataptr);
  60. void DisposeSwarm(void* dataptr);
  61.  
  62.  
  63. #endif